<!DOCTYPE html>
<html lang="en">
<head>
    <title>博客列表</title>
<#include "../../comm/meta-base.ftl" />
<#include "../../comm/meta-bootstrap.ftl" />
<#include "../../comm/meta-summernote.ftl" />
<#include "../../comm/meta-layui.ftl" />
    <link rel="stylesheet" href="/static/css/index.css" media="all"/>
</head>
<body class="blog">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
    <legend>博客列表</legend>
</fieldset>

<table class="layui-table" lay-even="" lay-skin="nob">
    <colgroup>
        <col width="150">
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>blog标示</th>
        <th>title</th>
        <th>time</th>
        <th>operations</th>
    </tr>
    </thead>
    <tbody>
    <#list pager as item>
    <tr>
        <td>${item.blogId}</td>
        <td>${item.title}</td>
        <td>${item.createTime?number_to_datetime}</td>
        <td>
            <div class="layui-btn-group">
                <button onclick="edit('${item.blogId}')" class="layui-btn layui-btn-primary layui-btn-small">
                    <i class="layui-icon">&#xe642;</i>
                </button>
                <button onclick="delete('${item.blogId}')" class="layui-btn layui-btn-primary layui-btn-small">
                    <i class="layui-icon">&#xe640;</i>
                </button>
            </div>
        </td>
    </tr>
    </#list>
    </tbody>
</table>
<div id="page"></div>
</body>
<script type="text/javascript" src="/static/js/blog.js"></script>
<script>
    layui.use(['laypage'], function () {
        layui.laypage({
            cont: 'page'
            , pages: ${pageSize}
            , curr: ${pageNo}
            , groups: 3
            , skin: '#1E9FFF'
            , prev: '<em><</em>'
            , next: '<em>></em>'
            , skip: true
            , jump: function (obj, first) {
                //得到了当前页，用于向服务端请求对应数据
                var curr = obj.curr;
                if (!first) {
                    location.href = 'list?pageNo=' + curr
                }
            }
        });
    });
</script>
</html>